package com.atguigu.gmall.web.all.service.impl;

import com.atguigu.gmall.common.cache.GmallCache;
import com.atguigu.gmall.feign.product.CategoryFeignClient;
import com.atguigu.gmall.model.vo.IndexCategoryVo;
import com.atguigu.gmall.web.all.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IndexServiceImpl implements IndexService {


    @Autowired
    CategoryFeignClient categoryFeignClient;


    @GmallCache(
            cacheKeyExpr = "index:category:#{#method.getName()}",
            ttl = 1000*60*60*24*5,
            enableBloom = false)
    @Override
    public List<IndexCategoryVo> getIndexCategory(){
        List<IndexCategoryVo> allCategorysForIndexHtml = categoryFeignClient.getAllCategorysForIndexHtml();
        return allCategorysForIndexHtml;
    }
}
